import React from 'react';
import contextObj from './context'
import { useContext } from 'react';

const Child1 = () => {
    const { state, dispatch } = useContext(contextObj)
    //console.log('data', data); //data就是 {state, dispatch}
    console.log('state', state);
    return (
        <div>
            <p onClick={() => {
                dispatch({ type: '+', payload: 10 })
            }}>child1-{state.count}</p>
        </div>
    );
}

export default Child1;
